package hlhj.fhp.supreme.adapters

import android.content.Context
import android.support.v4.view.PagerAdapter
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.bumptech.glide.Glide
import fhp.hlhj.giantfold.utils.LogUtil
import hlhj.fhp.supreme.R
import hlhj.fhp.supreme.javabean.BannerBean
import hlhj.fhp.supreme.network.Urls
import java.util.ArrayList

/**
 * Created by Administrator on 2018\4\8 0008.
 */
class HonePagerAdp(private val context:Context,private val datas:ArrayList<BannerBean.DataBean>) :PagerAdapter() {
    override fun instantiateItem(container: ViewGroup?, position: Int): Any {
       val view = LayoutInflater.from(context).inflate(R.layout.banner_item,null)
//        LogUtil.log("试一试--------------------------${datas.size}")
        Glide.with(context).load(datas[position%datas.size].image).asBitmap().dontAnimate().into(view.findViewById(R.id.img))
        container?.addView(view)
        return view
    }
    override fun isViewFromObject(view: View?, `object`: Any?): Boolean {
        return view==`object`
    }
    override fun getCount(): Int {
        return Int.MAX_VALUE
    }

    override fun destroyItem(container: ViewGroup?, position: Int, `object`: Any?) {
//
    }
}